import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui';
import PublicStyle from './assets/css/publicStyle.css';
import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios';

// import 
//已经导入所有elm组件
Vue.use(ElementUI);
Vue.use(PublicStyle)




Vue.config.productionTip = false
Vue.prototype.$http = axios
axios.defaults.baseURL = 'http://localhost:8888/api/private/v1/'
// axios.defaults.baseURL='http://127.0.0.1:8888/api/private/v1/'
axios.interceptors.response.use((ret) => {
  return ret.data;
}, (err) => {
  console.log(err)
})

axios.interceptors.request.use((config)=>{
  const tk = sessionStorage.getItem('token');
  console.log(tk+"当前储存的token")
  config.headers.Authorization = tk;
  console.log("token",tk)
  return config;
},(err)=>{
  console.log(err);
})


new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
